package edu.hnu.cloudflight.android.util;

import java.util.ArrayList;
import java.util.List;

import edu.hnu.cloudflight.android.domain.City;

public class FlightCitiesUtil {

	@SuppressWarnings("unused")
	private static final String TAG = FlightCitiesUtil.class.getSimpleName();
	
	public static List<City> flightcities ;
	
	public static List<String> getCitiesBySpell(String spell){
		List<String> cities = new ArrayList<String>();
		for(City flightCity : flightcities){
			if(flightCity.pinyin.startsWith(spell.toLowerCase())){
				cities.add(flightCity.city);
			}
		}
		return cities;
	}
	
	
	public static List<String> getCitiesByCC(String cc){
		List<String> cities = new ArrayList<String>();
		for(City flightCity : flightcities){
			if(flightCity.city.startsWith(cc)){
				cities.add(flightCity.city);
			}
		}
		return cities;
		//return cities.toArray(new String[]{});
	}
	
	
	public static String[] getCitiesOfCC(){
		List<String> cities = new ArrayList<String>();
		for(City flightCity : flightcities){
				cities.add(flightCity.city);
		}
		return cities.toArray(new String[]{});
	}
	
	public static String[] getCitiesOfSpell(){
		List<String> cities = new ArrayList<String>();
		for(City flightCity : flightcities){
				cities.add(flightCity.spell);
		}
		return cities.toArray(new String[]{});
	}
}
